<?php /** @var User $thatUser */ ?>
<div class="user-info-block">
    <?php if (isset($thatUser) && $thatUser->getId() > 0): ?>
        <div class="user-avatar"><img src="<?php echo $thatUser->getDisplayAvatarUrl() ?>" alt="用户头像" width="100%"/></div>
        <div class="username"><?php echo $thatUser->getDisplayName() ?></div>
        <div class="summary">
            <div class="col">
                <a href="<?php echo base_url('home/userCenter/commodity/' . $thatUser->getId()) ?>">
                    <div class="name">发布</div>
                    <div class="num"><?php echo $thatUser->getDisplayCountCommodity() ?></div>
                </a>
            </div>
            <div class="col">
                <a href="<?php echo base_url('home/userCenter/wantToBuy/' . $thatUser->getId()) ?>">
                    <div class="name">求购</div>
                    <div class="num"><?php echo $thatUser->getDisplayCountCommodityRequire() ?></div>
                </a>
            </div>
            <div class="col" style="border-right: none !important;">
                <a href="<?php echo base_url('home/userCenter/favorite') ?>">
                    <div class="name">收藏</div>
                    <div class="num"><?php echo $thatUser->getDisplayCountCommodityFavorite() ?></div>
                </a>
            </div>
            <div class="clearfix"></div>
        </div>
    <?php endif; ?>
</div>
<div class="nav">
    <ul>
        <li <?php if (isset($UserCenterAction) && strcasecmp($UserCenterAction, 'commodity') == 0) echo 'class="active"' ?>>
            <a href="<?php echo base_url('home/userCenter/commodity/' . $thatUser->getId()) ?>"><?php if ($thatUser->getId() == $CurrentUser->getId()) {
                    echo "我";
                } else {
                    echo '他';
                } ?>的发布</a></li>
        <li <?php if (isset($UserCenterAction) && strcasecmp($UserCenterAction, 'wantToBuy') == 0) echo 'class="active"' ?>>
            <a href="<?php echo base_url('home/userCenter/wantToBuy/' . $thatUser->getId()) ?>"><?php if ($thatUser->getId() == $CurrentUser->getId()) {
                    echo "我";
                } else {
                    echo '他';
                } ?>的求购</a></li>
        <?php if ($thatUser->getId() == $CurrentUser->getId()): ?>
            <li <?php if (isset($UserCenterAction) && strcasecmp($UserCenterAction, 'favorite') == 0) echo 'class="active"' ?>>
                <a href="<?php echo base_url('home/userCenter/favorite') ?>">我的收藏</a></li>
            <li <?php if (isset($UserCenterAction) && strcasecmp($UserCenterAction, 'message') == 0) echo 'class="active"' ?>>
                <a href="<?php echo base_url('home/userCenter/message') ?>">我的消息</a></li>
            <li <?php if (isset($UserCenterAction) && ($UserCenterAction === false || strcasecmp($UserCenterAction, 'userInfo') == 0)) echo 'class="active"' ?>>
                <a href="<?php echo base_url('home/userCenter/userInfo') ?>">个人资料</a></li>
        <?php endif; ?>
    </ul>
</div>
